package cn.wyx.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import cn.wyx.action.CalculatorAction;

public class CalculatorInterceptor extends AbstractInterceptor{

	public String intercept(ActionInvocation invocation) throws Exception {
		CalculatorAction calculatorAction=(CalculatorAction) invocation.getAction();
		if (invocation.getProxy().getMethod().equals("chu")&&calculatorAction.getNum2()==0) {
			return "error";
		}else {
			return invocation.invoke();
		}
	}
  
}
